package com.txtTool.articleTxt.utils;

import java.security.MessageDigest;

/**
 * Created scs on 2018-07-25.
 */
public class MD5Utils16 {

    public static String encodeString(String value){
        StringBuilder sb=new StringBuilder();
        try {
            MessageDigest messageDigest= MessageDigest.getInstance("md5");
            byte[] bytes=messageDigest.digest(value.getBytes());
            for(int i=0;i<bytes.length;i++){
                int tempInt=bytes[i]&0xff;
                if(tempInt<16){
                    sb.append(0);
                }
                sb.append(Integer.toHexString(tempInt));
            }
        } catch (Exception e) {
        }
        return  sb.toString().substring(8, 24); // 16位的加密
//        return sb.toString();
    }
}
